"""
@File         : out.py
@Time         : 2024/05/06 15:55:56
@Author       : Qrj
@Email        : 923207736@qq.com
@Description  : 通知公告的序列化模型
"""

from datetime import datetime

from pydantic import BaseModel, Field, TypeAdapter

from src.schemas.out import BaseOutSchemaConfigMixin


class NoticeCompleteOutSchema(BaseModel, BaseOutSchemaConfigMixin):
    """通知公告完整的序列化模型"""

    id: int = Field(default=..., description="主键")
    tenant_id: int = Field(default=..., description="租户ID")
    title: str = Field(default=..., description="公告标题")
    content: str = Field(default=..., description="公告内容")
    status: bool = Field(default=..., description="状态")
    show_order: int = Field(default=..., description="显示顺序")
    expiration_datetime: datetime = Field(default=..., description="过期时间")
    create_datetime: datetime = Field(default=..., description="创建时间")
    update_datetime: datetime = Field(default=..., description="修改时间")
    creator_username: str = Field(default=..., description="创建者用户名")
    updater_username: str = Field(default=..., description="修改者用户名")


# 完整信息的通知公告序列化列表模型
ListNoticeCompleteOutSchema = TypeAdapter(list[NoticeCompleteOutSchema])


class NoticeNoContentOutSchema(BaseModel, BaseOutSchemaConfigMixin):
    """通知公告不带公告内容的序列化模型"""

    id: int = Field(default=..., description="主键")
    tenant_id: int = Field(default=..., description="租户ID")
    title: str = Field(default=..., description="公告标题")
    status: bool = Field(default=..., description="状态")
    show_order: int = Field(default=..., description="显示顺序")
    expiration_datetime: datetime = Field(default=..., description="过期时间")
    create_datetime: datetime = Field(default=..., description="创建时间")
    update_datetime: datetime = Field(default=..., description="修改时间")
    creator_username: str = Field(default=..., description="创建者用户名")
    updater_username: str = Field(default=..., description="修改者用户名")


# 通知公告不带公告内容的序列化列表模型
ListNoticeNoContentOutSchema = TypeAdapter(list[NoticeNoContentOutSchema])
